package com.lby.springcloud.ddd.usercontext.north.remote.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.lby.springcloud.ddd.security.NeedLogin;

/**
 * 测试类，该类跟DDD没关系
 * @author Administrator
 *
 */
@RestController
@RefreshScope
public class EchoController {

	@Value("${useLocalCache:false}")
    private boolean useLocalCache;
	
	@Value("${cache}")
    private String cache;
	
	
	@RequestMapping(value = "/echo/{string}", method = RequestMethod.GET)
	public String echo(@PathVariable String string) {
		return "Hello Nacos Discovery login :" + string + ",useLocalCache:" + useLocalCache;
	}
	
	
	@RequestMapping(value = "/echoCache/{string}", method = RequestMethod.GET)
	public String echoCache(@PathVariable String string) {
		return "cache:" + cache;
	}
	
	@RequestMapping(value = "/login/{string}", method = RequestMethod.GET)
	@NeedLogin
	public String login(@PathVariable String string) {
		return "Hello Nacos Discovery login :" + string;
	}
}
